<template>
  <div class="m_left">
    <div class="left_n">管理中心</div>
    <div class="left_m" v-if="type == 0 || type == 1"> <!-- type可能是字符串 通过>=或者<=无法 -->
        <div class="left_m_t t_bg1">订单中心</div>
        <ul v-if="type == 0">
            <li><router-link :to="{name: 'SelfOrderList'}">我的订单</router-link></li>
            <li><router-link :to='{name:"AddressList"}' :class='{"now":$route.name.lastIndexOf("Address") != -1}'>收货地址</router-link></li>
        </ul>
        <ul v-if="type == 1">
            <li><router-link to='AllOrderList' :class='{"now":$route.name.lastIndexOf("Order") != -1}'>全部订单</router-link></li>
            <li><router-link :to='{name:"AddressList"}' :class='{"now":$route.name.lastIndexOf("Address") != -1}'>收货地址</router-link></li>
        </ul>
    
    </div>
   <div class="left_m" v-if="type == 1">
        <div class="left_m_t t_bg2">用户中心</div>
        <ul>
            <li><router-link :to='{name:"UserList0"}' :class='{"now":$route.name.lastIndexOf("UserList0") != -1}'>用户列表</router-link></li>
            <li><router-link :to='{name:"UserList1"}' :class='{"now":$route.name.lastIndexOf("UserList1") != -1}'>个人信息</router-link></li>
            <li><router-link :to='{name:"FavoriteList"}' :class='{"now":$route.name.lastIndexOf("FavoriteList") != -1}'>我的收藏</router-link></li>
        
        </ul>
    </div>

    <div class="left_m" v-if="type == 0 ">
        <div class="left_m_t t_bg2">个人中心</div>
        <ul>
            <li><router-link :to='{name:"UserList1"}' :class='{"now":$route.name.lastIndexOf("UserList1") != -1}'>个人信息</router-link></li>
            <li><router-link :to='{name:"FavoriteList"}' :class='{"now":$route.name.lastIndexOf("favoriteFiler") != -1}'>我的收藏</router-link></li>
        </ul>
    </div>
    <!-- <div class="left_m" v-if="type == 0">
        <div class="left_m_t t_bg3">账户中心</div>
        <ul>
            <li><a href="Member_Safe.html">账户安全</a></li>
        </ul>
    </div> -->
    <div class="left_m" v-if='type == 1'>
        <div class="left_m_t t_bg4">商品管理</div>
        <ul>
            <li><router-link :to='{name:"ProductList"}' :class='{"now":$route.name.lastIndexOf("Product") != -1}'>商品管理</router-link></li>
            <li><router-link :to='{name:"CategoryList"}' :class='{"now":$route.name.lastIndexOf("Category") != -1}'>分类管理</router-link></li>
        </ul>
    </div>
    <div class="left_m">
        <div class="left_m_t t_bg4">资讯中心</div>
        <ul>
            <li><router-link :to='{name:"NewsList"}' :class='{"now":$route.name.lastIndexOf("News") != -1}'>资讯列表</router-link></li>
        </ul>
    </div>
</div>
</template>

<script>
export default {
    data() {
        return {
            type: '', 
            sessionStorage: sessionStorage
        }
    },
    created() {
        this.type = this.sessionStorage.getItem('type');
        console.log("type", this.type)
    }
}
</script>

<style>

</style>